package com.mvc.security.model;

import javax.persistence.Entity;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.mvc.framework.model.CommonAuditableEntity;

@Entity(name = "F_DEPARTMENT")
public class Department extends CommonAuditableEntity {
	private static final int MAX_LENGTH = 64;
	/**
	 * ROOT
	 */
	public static final Department ROOT = new Department();
	public static final String PATH_SEPARATOR = Menu.PATH_SEPARATOR;
	static{
		ROOT.setObjectId(0);
		ROOT.setParentId(-1);
		ROOT.setName("ROOT");
		ROOT.setFullName(PATH_SEPARATOR + "ROOT");
		ROOT.setLayer(PATH_SEPARATOR + 0);
	}
	@Length(min = 1, max = MAX_LENGTH)
	@NotNull
	private String name;
	
	private Integer parentId;

	private Long leaderId;

	private String fullName;

	private String telephone;

	private String remark;
	
	private String layer;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	public String getFullName() {
    	return fullName;
    }

	public void setFullName(String fullName) {
    	this.fullName = fullName;
    }

	public Long getLeaderId() {
    	return leaderId;
    }

	public void setLeaderId(Long leaderId) {
    	this.leaderId = leaderId;
    }

	public String getTelephone() {
    	return telephone;
    }

	public void setTelephone(String telephone) {
    	this.telephone = telephone;
    }

	public String getRemark() {
    	return remark;
    }

	public void setRemark(String remark) {
    	this.remark = remark;
    }

	public String getLayer() {
    	return layer;
    }

	public void setLayer(String layer) {
    	this.layer = layer;
    }

	@Override
    public String toString() {
	    return String.valueOf(getObjectId());
    }
}
